<?php  session_start() ; 

/****************************************************
* AUTEUR		
* TITRE			config/config.inc.php
* DESCRIPTION	Fichier de configuration
* DATE			
* TODO			
****************************************************/
# debug()
/*function debug ($datas, $die=false) {

	echo '<pre>';
	var_export($datas);
	echo '</pre>';
	if ($die) die();
	
}
*/


# REQUIRE FILES
error_reporting(E_STRICT); //nous voulons afficher toutes les erreurs php
//error_reporting(0); //nous voulons afficher toutes les erreurs php


//MODE
//define('MODE', ($_SERVER['SERVER_NAME'] == 'localhost') ? 'developpement' : 'production' ) ; //définition prod / dev
define('MODE', 'developpement');

# DSN
switch (MODE) {

/* WORK MODE */

	case 'developpement' :
		
		# DSN
		$db_user 	= 'root';
		$db_pass 	= '';
		$db_host 	= 'localhost';
		$db_name 	= 'mypoi';
		$db_dsn 	= "mysql://".$db_user.":".$db_pass."@".$db_host."/".$db_name;
		
		define('HTTP_ROOT', 'http://'.$_SERVER['HTTP_HOST'].'/mypoi') ;

	break ;

/* ONLINE MODE 	*/

	case 'production' :

		# DSN
		$db_user 	= 'root';
		$db_pass 	= '';
		$db_host 	= 'localhost';
		$db_name 	= '';
		$db_dsn 	= "mysql://".$db_user.":".$db_pass."@".$db_host."/".$db_name;
		
		define('HTTP_ROOT', 'http://'.$_SERVER['HTTP_HOST'].'/mypoi') ;
		
	
	break ;

}



# CONSTANT
// il est pratique de définir des constantes qui sont globales
//HTTP
define('HTTP_CSS_PATH', HTTP_ROOT . '/_inc/css/') ;
define('HTTP_JS_PATH' , HTTP_ROOT . '/_inc/js') ;
define('HTTP_UPL_PATH', HTTP_ROOT . '/_inc/media/upload') ;
define('HTTP_IMG_PATH', HTTP_ROOT . '/_inc/img/') ;
define('HTTP_ADMIN_PATH', HTTP_ROOT . '/gestion/') ;

//APP
define('APP_INC_PATH', 		dirname(__FILE__) ) ;
define('APP_PEAR_PATH', 	APP_INC_PATH . '/lib/pear/') ;
define('APP_TPL_PATH', 		APP_INC_PATH . '/template/') ;
define('APP_CSS_PATH', 		APP_INC_PATH . '/css/') ;
define('APP_JS_PATH', 		APP_INC_PATH . '/js/') ;
define('APP_UTILS_PATH', 	APP_INC_PATH . '/utils/') ;
define('APP_CLASS_PATH',	APP_INC_PATH . '/classe/') ;
define('APP_IMG_PATH', 		APP_INC_PATH . '/img/') ;
define('APP_UPL_PATH', 		APP_INC_PATH . '/media/upload') ;

# REQUIRE FILES
// appel des fichiers contenant les fonctions
//require_once APP_UTILS_PATH.'/generalupdate.func.php' ;
//require_once APP_UTILS_PATH.'/function.func.php' ;
//require_once APP_UTILS_PATH.'/utils.func.php' ;
//require_once APP_UTILS_PATH.'/minmax.func.php' ;
//require_once APP_UTILS_PATH.'/content.func.php' ;

# INCLUDE PATH
$includeSeparator = (substr(PHP_OS,0,3) == 'WIN') ? ';' : ':';
@ini_set('include_path', '.'.$includeSeparator.APP_PEAR_PATH);

/**********************************Connexion à la base de données*******************************/
mysql_connect($db_host, $db_user, $db_pass) or die("Impossible de se connecter : " . mysql_error());
mysql_select_db($db_name);
mysql_query("SET NAMES 'utf8'");
/*******************************FIN Connexion à la base de données******************************/
?>